package entities

import "mlgmd.com/hearsay/base"

type Report struct {
	Id           int      `xorm:"pk autoincr" json:"id"`
	CreatorId    int      `json:"creatorId"`
	CreatedTime  int64    `json:"createdTime"`
	TargetType   string   `json:"targetType"` // 目标类型: hearsay/reward/user
	TargetId     int      `json:"targetId"`
	TargetUserId int      `json:"targetUserId"` // 目标用户id
	Content      string   `xorm:"text" json:"content"`
	Images       []string `json:"images"`
	Reply        string   `xorm:"text" json:"reply"` // 回复
	ReplyTime    int64    `json:"replyTime"`
	Publicly     bool     `json:"publicly"` // 可公开
}

func init() {
	base.Must(base.DB.Sync(&Report{}))
}

func (r *Report) AfterLoad() {
	if r.Images == nil {
		r.Images = make([]string, 0)
	}
}
